package com.zhuiyun.project.api.video.videoReview.mapper;

import com.zhuiyun.project.api.video.videoReview.entity.VideoReview;
import com.zhuiyun.project.api.video.videoReview.model.VideoReviewModel;
import com.zhuiyun.project.common.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
* @Author qsh
* @Description 视频审核
* @Date 2023/12/26 9:56
* @Return
* @param
*/
@Mapper
public interface VideoReviewMapper extends BaseMapper<VideoReview> {
    //查询未审核视频
    @Select("<script>" +
            "select * from video where review_status='未审核' and identifying='u'" +
            "<if test=\"videoReviewModel.videoId != null and videoReviewModel.videoId != ''\">" +
            "and video_id LIKE CONCAT('%',#{videoReviewModel.videoId},'%') </if>" +

            "<if test=\"videoReviewModel.videoTopic != null and videoReviewModel.videoTopic != ''\">" +
            "and video_topic LIKE CONCAT('%',#{videoReviewModel.videoTopic},'%') </if>" +

            "<if test=\"videoReviewModel.userAccount != null and videoReviewModel.userAccount != ''\">" +
            "and user_account LIKE CONCAT('%',#{videoReviewModel.userAccount},'%') </if>" +

            "<if test=\"videoReviewModel.videoStatus != null and videoReviewModel.videoStatus != ''\">" +
            "and video_status LIKE CONCAT('%',#{videoReviewModel.videoStatus},'%') </if>" +

            "<if test=\"videoReviewModel.auditStartTime != null and videoReviewModel.auditEndTime != null\">" +
            "and audit_time BETWEEN #{videoReviewModel.auditStartTime} and #{videoReviewModel.auditEndTime} </if>" +

            "<if test=\"videoReviewModel.UploadStartTime != null and videoReviewModel.UploadEndTime != null\">" +
            "and creation_time BETWEEN #{videoReviewModel.UploadStartTime} and #{videoReviewModel.UploadEndTime} </if>" +
            "</script>")
    List<VideoReviewModel> videoReviewList(@Param("videoReviewModel") VideoReviewModel videoReviewModel);

    //查询审核通过视频
    @Select("<script>" +
            "select * from video where review_status='已通过' and identifying='u' and is_delete=1" +
            "<if test=\"videoReviewModel.videoId != null and videoReviewModel.videoId != ''\">" +
            "and video_id LIKE CONCAT('%',#{videoReviewModel.videoId},'%') </if>" +

            "<if test=\"videoReviewModel.videoTopic != null and videoReviewModel.videoTopic != ''\">" +
            "and video_topic LIKE CONCAT('%',#{videoReviewModel.videoTopic},'%') </if>" +

            "<if test=\"videoReviewModel.userAccount != null and videoReviewModel.userAccount != ''\">" +
            "and user_account LIKE CONCAT('%',#{videoReviewModel.userAccount},'%') </if>" +

            "<if test=\"videoReviewModel.videoStatus != null and videoReviewModel.videoStatus != ''\">" +
            "and video_status LIKE CONCAT('%',#{videoReviewModel.videoStatus},'%') </if>" +

            "<if test=\"videoReviewModel.auditStartTime != null and videoReviewModel.auditEndTime != null\">" +
            "and audit_time BETWEEN #{videoReviewModel.auditStartTime} and #{videoReviewModel.auditEndTime} </if>" +

            "<if test=\"videoReviewModel.UploadStartTime != null and videoReviewModel.UploadEndTime != null\">" +
            "and creation_time BETWEEN #{videoReviewModel.UploadStartTime} and #{videoReviewModel.UploadEndTime} </if>" +
            "</script>")
    List<VideoReviewModel> videoReviewListT(@Param("videoReviewModel") VideoReviewModel videoReviewModel);

    //查询审核拒绝视频
    @Select("<script>" +
            "select * from video where review_status='已拒绝' and identifying='u'" +
            "<if test=\"videoReviewModel.videoId != null and videoReviewModel.videoId != ''\">" +
            "and video_id LIKE CONCAT('%',#{videoReviewModel.videoId},'%') </if>" +

            "<if test=\"videoReviewModel.videoTopic != null and videoReviewModel.videoTopic != ''\">" +
            "and video_topic LIKE CONCAT('%',#{videoReviewModel.videoTopic},'%') </if>" +

            "<if test=\"videoReviewModel.userAccount != null and videoReviewModel.userAccount != ''\">" +
            "and user_account LIKE CONCAT('%',#{videoReviewModel.userAccount},'%') </if>" +

            "<if test=\"videoReviewModel.videoStatus != null and videoReviewModel.videoStatus != ''\">" +
            "and video_status LIKE CONCAT('%',#{videoReviewModel.videoStatus},'%') </if>" +

            "<if test=\"videoReviewModel.auditStartTime != null and videoReviewModel.auditEndTime != null\">" +
            "and audit_time BETWEEN #{videoReviewModel.auditStartTime} and #{videoReviewModel.auditEndTime} </if>" +

            "<if test=\"videoReviewModel.UploadStartTime != null and videoReviewModel.UploadEndTime != null\">" +
            "and creation_time BETWEEN #{videoReviewModel.UploadStartTime} and #{videoReviewModel.UploadEndTime} </if>" +
            "</script>")
    List<VideoReviewModel> videoReviewListW(@Param("videoReviewModel") VideoReviewModel videoReviewModel);
}
